package com.rt.java.math;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class BigDecimalDemo {
    public static void main(String[] args) {
        BigDecimal ten = new BigDecimal("10");
        BigDecimal three = new BigDecimal("3");
        String add = ten.add(three).toPlainString(); // 13
        String subtract = ten.subtract(three).toPlainString(); // 7
        String multiply = ten.multiply(three).toPlainString(); // 30
        String divide = ten.divide(three, 3, RoundingMode.HALF_UP).toPlainString(); // 3.333 四舍五入
    }
}
